import request from '@/utils/request'
import { exportMethod } from '@/utils/utils'
import { CHECC_API_CMS } from '@/constants/proxy'

const getProjectList2 = (params) => {
  return request.post(`/api/zzlx/zzq/getZzlxInfo`, params)
}
const getProjectList = (params: any = {}) => {
  return request.post(
    CHECC_API_CMS +
      `/xmzx/projectManagement/listPage?current=${params.current}&size=${params.size}`,
    params
  )
}
const getProjectListYs = (params: any = {}) => {
  console.log("click me ", "click me");
  
  return request.post(
    CHECC_API_CMS +
      `/xmzx/projectManagement/listPageYs?current=${params.current}&size=${params.size}`,
    params
  )
}
const getProjectDetail = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/projectManagement/getDetailById`, params)
}
//保存项目变更
const saveProjectChange = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/change-project/insert`, params)
}
//保存项目变更(流程)
const saveProjectChangeProcess = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/change-project/insertliucheng`, params)
}
const submitProjectChange = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/change-project/update`, params)
}
const insertProject = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/projectManagement/insert`, params)
}
const updateProject = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/projectManagement/update`, params)
}
const delBatchProject = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/projectManagement/delBatch`, params)
}
const openProjectStatus = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/projectManagement/openStatus`, params)
}
const closeProjectStatus = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/projectManagement/closeStatus`, params)
}

//导出项目列表数据
const exportProjectList = (data: any, name) => {
  const params = {
    method: 'post',
    url: CHECC_API_CMS + '/xmzx/projectManagement/export',
    data: data,
    fileName: name,
  }
  return exportMethod(params)
}
//导出项目变更列表数据
const exportChangeProjectList = (data: any) => {
  const params = {
    method: 'post',
    url: CHECC_API_CMS + '/xmzx/change-project/export',
    data: data,
    fileName: '项目变更数据表格',
  }
  return exportMethod(params)
}
const getChangeList = (params: any = {}) => {
  return request.post(
    CHECC_API_CMS +
      `/xmzx/change-project/listPageliucheng?current=${params.current}&size=${params.size}`,
    params
  )
}
const getDetailById = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/change-project/getDetailById`, params)
}
const examineChange = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/change-project/updateStatus`, params)
}
//获取项目相关专利
const getProjectPatent = (params: any = {}) => {
  return request.post(
    CHECC_API_CMS +
      `/kjsl/tresult/patent/list?current=${params.current}&size=${params.size}&projectId=${params.projectId}`
  )
}
//获取项目相关软件著作权
const getProjectSoftware = (params: any = {}) => {
  return request.post(
    CHECC_API_CMS +
      `/kjsl/tresult/copyrights/list?current=${params.current}&size=${params.size}&projectId=${params.projectId}`
  )
}
//获取项目相关学术著作
const getProjectAcademic = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/kjsl/tresult/academicwork/list`, params)
}
//获取项目相关学术论文
const getProjectThesis = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/kjsl/tresult/academicpaper/list`, params)
}
//获取项目相关科技奖项
const getProjectAwards = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/kjsl/tresult/techaward/list`, params)
}

// 科技实力人才奖励流程id
const processInstanceId = (data: any) => {
  return request({
    url: '/checc-api/kgptKjslTawardTechtalent/detail',
    method: 'post',
    data,
  })
}
export {
  getProjectList2,
  getProjectList,
  getProjectListYs,
  getProjectDetail,
  saveProjectChange,
  saveProjectChangeProcess,
  submitProjectChange,
  insertProject,
  updateProject,
  delBatchProject,
  openProjectStatus,
  closeProjectStatus,
  exportProjectList,
  exportChangeProjectList,
  getChangeList,
  getDetailById,
  examineChange,
  getProjectPatent,
  getProjectSoftware,
  getProjectAcademic,
  getProjectThesis,
  getProjectAwards,
  processInstanceId,
}
